<template>
	<view class="">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<view class="list">
				<view class="li" v-for="(item,index) in dataList" :key="index">
					<view class="left">
						<image :src="item.avatar" mode="aspectFill"></image>
						<view class="info">
							<text>{{item.nickname}}</text>
							<text>ID:{{item.cid}}</text>
						</view>
					</view>
					<view class="right" @click="onFollow(item.cid)">
						<button>取消关注</button>
					</view>
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
	import { userCircleMyFocus,userCircleFollow } from '@/api/reserve.js';
	export default {
		data() {
			return {
				dataList: [],
				baseUrl: this.$baseUrl
			}
		},
		methods: {
			onJmup(url) {
				uni.navigateTo({
					url: url
				})
			},
			onFollow(id) {
				userCircleFollow({
					cid: id
				}).then(res => {
					this.$refs.paging.reload()
				}).catch(err => {
					this.$util.Tips({
						title: err
					});
				})
			},
			queryList(pageNo, pageSize) {
				// 此处请求仅为演示，请替换为自己项目中的请求
				const params = {
					page: pageNo,
					pageSize: pageSize
				}
				userCircleMyFocus(params).then(res => {
					this.$refs.paging.complete(res.data.data);
				})
			}
		}
	}
</script>
<style>
	page {
		height: 100%;
		background: #003153;
	}
	
</style>
<style scoped lang="scss">
	.list {
		padding:0 40rpx 40rpx 40rpx;
		.li {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx 0;
			border-bottom: 2rpx solid #F9FAFC;
			.left {
				display: flex;
				align-items: center;
				image {
					width: 100rpx;
					height: 100rpx;
				}
				.info {
					display: flex;
					flex-direction: column;
					font-size: 28rpx;
					color: #FFFFFF;
					margin-left: 30rpx;
					text{
						&:nth-child(2) {
							font-size: 24rpx;
							color: #B2B1BF;
							margin-top: 16rpx;
						}
					}
				}
			}
			.right {
				button {
					flex: 0 0 129rpx;
					width: 129rpx;
					height: 54rpx;
					background: #FFFFFF;
					border-radius: 200rpx 200rpx 200rpx 200rpx;
					font-size: 23rpx;
					color: #003153;
					text-align: center;
					line-height: 54rpx;
				}
			}
		}
	}
</style>